<!doctype html>
<html lang="zh-CN">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>用户简介查询</title>
    <style>
        /* 全局样式重置与基础设置 */
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
            font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
        }

        body {
            /* 优化：多层渐变叠加+柔和纹理，增强层次感 */
            background:
                    linear-gradient(120deg, #f5f7ff 0%, #e6edf7 50%, #d1e0f4 100%),
                    radial-gradient(circle at 10% 20%, rgba(66, 153, 225, 0.05) 0%, transparent 20%),
                    radial-gradient(circle at 90% 80%, rgba(139, 92, 246, 0.05) 0%, transparent 20%);
            min-height: 100vh;
            display: flex;
            justify-content: center;
            align-items: center;
            padding: 20px;
            background-attachment: fixed; /* 固定背景，滚动时不偏移 */
            background-size: cover;
        }

        /* 核心容器 - 卡片式设计（增强与背景的融合感） */
        .query-container {
            background-color: rgba(255, 255, 255, 0.98); /* 更高透明度，贴近背景 */
            width: 100%;
            max-width: 500px;
            padding: 35px;
            border-radius: 16px; /* 圆角增大，更显柔和 */
            box-shadow: 0 8px 30px rgba(0, 0, 0, 0.06); /* 阴影更通透，避免厚重感 */
            transition: all 0.3s ease;
            backdrop-filter: blur(8px); /* 毛玻璃效果增强，突出卡片层次 */
            border: 1px solid rgba(255, 255, 255, 0.5); /* 细边框，提升精致度 */
        }

        .query-container:hover {
            box-shadow: 0 12px 40px rgba(0, 0, 0, 0.08); /* hover时阴影渐变更自然 */
            transform: translateY(-3px); /* 轻微上浮，呼应按钮交互 */
        }

        /* 标题样式（微调色彩，呼应背景） */
        .query-title {
            font-size: 24px;
            font-weight: 600;
            color: #2d3748;
            margin-bottom: 28px;
            text-align: center;
            position: relative;
            letter-spacing: 0.5px; /* 字间距微调，提升阅读感 */
        }

        .query-title::after {
            content: '';
            display: block;
            width: 60px;
            height: 3px;
            /* 优化：渐变下划线，与背景色彩呼应 */
            background: linear-gradient(90deg, #4299e1 0%, #8b5cf6 100%);
            margin: 8px auto 0;
            border-radius: 3px;
        }

        /* 标签样式 */
        .form-label {
            display: block;
            margin-top: 20px;
            margin-bottom: 8px;
            font-weight: 500;
            color: #4a5568;
            font-size: 15px;
        }

        /* 输入框与文本域样式（增强通透感） */
        .form-input, .form-textarea {
            width: 100%;
            padding: 12px 15px;
            margin: 0;
            border: 1px solid #e2e8f0;
            border-radius: 10px; /* 圆角增大，与卡片风格统一 */
            font-size: 14px;
            color: #2d3748;
            transition: all 0.3s ease;
            background-color: rgba(255, 255, 255, 0.8); /* 输入框轻微透明，呼应背景 */
        }

        /* 聚焦状态 - 高亮反馈（色彩更丰富） */
        .form-input:focus, .form-textarea:focus {
            outline: none;
            border-color: #4299e1;
            box-shadow: 0 0 0 4px rgba(66, 153, 225, 0.12); /* 外发光更柔和 */
            background-color: #ffffff; /* 聚焦时恢复纯白，突出交互状态 */
        }

        /* 文本域特殊设置 */
        .form-textarea {
            min-height: 120px;
            resize: vertical;
            line-height: 1.6;
        }

        /* 按钮样式（渐变背景，提升视觉重点） */
        .query-btn {
            margin-top: 25px;
            padding: 12px 24px;
            /* 优化：按钮渐变背景，与标题下划线色彩呼应 */
            background: linear-gradient(90deg, #4299e1 0%, #3182ce 100%);
            color: #ffffff;
            border: none;
            border-radius: 10px;
            font-size: 15px;
            font-weight: 500;
            cursor: pointer;
            width: 100%;
            transition: all 0.3s ease;
            box-shadow: 0 4px 15px rgba(66, 153, 225, 0.2); /* 按钮自带轻微阴影，更立体 */
        }

        /* 按钮交互状态（过渡更细腻） */
        .query-btn:hover {
            background: linear-gradient(90deg, #3182ce 0%, #2b6cb0 100%); /*  hover时渐变色彩加深 */
            transform: translateY(-2px);
            box-shadow: 0 6px 20px rgba(66, 153, 225, 0.25); /* 阴影增强，突出按钮 */
        }

        .query-btn:active {
            transform: translateY(0);
            box-shadow: 0 2px 8px rgba(66, 153, 225, 0.2); /* 点击时阴影收缩，反馈更真实 */
        }

        /* 占位符样式优化 */
        ::placeholder {
            color: #a0aec0;
            opacity: 1;
        }
        .crtl{
            padding: 0.7rem 1.2rem;
            border: none;
            border-radius: 6px;
            font-size: 0.9rem;
            font-weight: 500;
            cursor: pointer;
            transition: all 0.3s ease;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            gap: 0.3rem;
        }
        /* 基础链接样式 - 与主题色调呼应 */
        a {
            color: #4299e1;
            text-decoration: none;
            font-weight: 500;
            position: relative;
            padding: 0 2px;
            transition: all 0.3s ease;
            border-radius: 3px;
            font-size: 20px;
        }

        /* 链接下划线动画效果 */
        a::after {
            content: '';
            position: absolute;
            bottom: -2px;
            left: 0;
            width: 0;
            height: 2px;
            background: linear-gradient(90deg, #4299e1 0%, #8b5cf6 100%);
            transition: width 0.3s ease;
            border-radius: 2px;
        }

        /* 悬停状态 - 增强交互反馈 */
        a:hover {
            color: #3182ce;
            background-color: rgba(66, 153, 225, 0.05);
        }

        a:hover::after {
            width: 100%;
        }

        /* 激活状态 - 点击反馈 */
        a:active {
            color: #2b6cb0;
            background-color: rgba(66, 153, 225, 0.1);
        }

        /* 已访问链接 - 保持和谐但有区分 */
        a:visited {
            color: #6b7280;
        }

        /* 带图标链接的特殊样式（如需配合Font Awesome使用） */
        a.with-icon {
            display: inline-flex;
            align-items: center;
            gap: 6px;
        }

        a.with-icon i {
            transition: transform 0.3s ease;
        }

        a.with-icon:hover i {
            transform: translateX(3px);
        }

    </style>
</head>
<body>
<div class="query-container">
    <h2 class="query-title">查询用户简介</h2>
    <div class="crtl">
        <a href="dashboard.html" style="accent-color:coral">返回控制台</a>
    </div>

    <label for="username" class="form-label">用户名</label>
    <input type="text" id="username" class="form-input" placeholder="请输入用户名">

    <label for="description" class="form-label">个人简介</label>
    <textarea id="description" class="form-textarea" readonly placeholder="查询结果将显示在这里"></textarea>

    <button id="queryBtn" class="query-btn">查询</button>
</div>

<script>
    document.getElementById("queryBtn").addEventListener("click", function () {
        const username = document.getElementById("username").value.trim();
        if (!username) {
            alert("请输入用户名！");
            return;
        }

        const xhr = new XMLHttpRequest();
        xhr.open("POST", "user/getInfoByName", true);
        xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");

        xhr.onreadystatechange = function () {
            if (xhr.readyState === 4) {
                const descriptionEl = document.getElementById("description");
                if (xhr.status === 200) {
                    try {
                        const resp = JSON.parse(xhr.responseText);
                        descriptionEl.value = resp.introduction || "未找到简介";
                    } catch (e) {
                        descriptionEl.value = "解析返回数据失败";
                    }
                } else {
                    descriptionEl.value = "请求失败：" + xhr.status;
                }
            }
        };

        xhr.send("username=" + encodeURIComponent(username));
    });
</script>
</body>
</html>